﻿using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using MS.InformationManagement.Presenter.InformedDocument;
using MS.InformationManagement.Presenter.Support;
using MS.InformationManagement.Support;

namespace MS.InformationManagement.WP.Layouts.MS.InformationManagement.WP
{
    public partial class InformedDocument : BaseApplicationPage, IInformedDocumentView
    {

        #region Fields

        InformedDocumentPresenter _presenter;

        #endregion

        #region Properties

        public int SelectedID
        {
            get { return int.Parse(Page.Request.QueryString["ID"].ToString()); }
        }

        public string DocumentUrl { get; set; }

        #endregion

        #region Form Events

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                _presenter = new InformedDocumentPresenter(this);
                if (IsPostBack) return;
                _presenter.HandleLoad();
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }

        }


        protected void btnClose_Click(object sender, EventArgs e)
        {

            this.GoCurrentUserHome();
        }

        #endregion

        #region Implemented Methods

        public void Show()
        {
           Response.Redirect(DocumentUrl,false);
        }

        #endregion
    }
}
